<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>AdminLTE 2 | Starter</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/bootstrap/dist/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/font-awesome/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/Ionicons/css/ionicons.min.css}">
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/adminlte/dist/css/AdminLTE.min.css}">
    <link rel="stylesheet" th:href="@{/adminlte/dist/css/skins/skin-blue.min.css}">
    <style type="text/css">
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <!--Main Header -->
    <div th:replace="@{/include/back_header}::header"></div>
    <!-- Left side column. contains the logo and sidebar -->
    <div th:replace="@{/include/back_sidebar}::sidebar"></div>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                添加商品信息
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">商品管理</a></li>
                <li class="active">添加商品</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">Please edit</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form role="form" class="form-horizontal" th:action="@{/goods/add}" method="post" enctype="multipart/form-data">
                        <div class="box-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品名</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control"  placeholder="商品名" name="goodsName">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label" for="exampleInputFile">商品图片</label>
                                <div class="col-sm-8">
                                    <input type="file" id="exampleInputFile" name="file">
                                    <!--<p class="help-block">Example block-level help text here.</p>-->
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品类型</label>
                                <div class="col-sm-8">
                                    <select id="goodsCategory" name="goodsCategory" class="form-control">
                                        <option th:each="goodsCategory,memberStat:${goodsCategory}" th:value="${goodsCategory.dictionaryId}" th:text="${goodsCategory.dictionaryValue}"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品单价</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control"  placeholder="商品单价" name="goodsPrice" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品库存</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control"  placeholder="商品库存" name="goodsInventory" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品描述</label>
                                <div class="col-sm-8">
                                    <textarea class="form-control"  placeholder="商品描述" name="goodsDescription" ></textarea>
                                </div>
                            </div>

                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-info pull-right">Submit</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
                <!-- /.box -->
                <!-- general form elements disabled -->
            </div>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <!-- Main Footer -->
    <div th:replace="@{/include/back_footer}::footer"></div>

</div>
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->

<script th:src="@{/adminlte/bower_components/jquery/dist/jquery.min.js}"></script>
<script th:src="@{/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js}"></script>
<script th:src="@{/adminlte/dist/js/adminlte.min.js}"></script>
<script th:src="@{/adminlte/bower_components/datatables.net/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/adminlte/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js}"></script>
<script th:src="@{/adminlte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js}"></script>
<script th:src="@{/adminlte/bower_components/fastclick/lib/fastclick.js}"></script>
<script th:src="@{/adminlte/bower_components/layer-v3.1.1/layer/layer.js}"></script>
<script th:src="@{/adminlte/dist/js/demo.js}"></script>
<!-- page script -->
<script>
    $(function () {
        $("#goo").addClass("active");
        $(".btn-delete").on("click", function () {
            var table = $("#example").DataTable();
            var row=table.row($(this).parents('tr'))
            var tr=$(this).parents("tr");
            var idValue=tr.find("td:eq(0)").html();
            var currentName=tr.find("td:eq(1)").html();

            layer.confirm('确定删除【 ' + currentName + "】", {icon: 3, title: '提示'}, function (index) {
                $.ajax({
                    type: "POST",
                    url: "${base}/customer/del",
                    data: {id: idValue},
                    dataType:"json",
                    success: function (msg) {
                        if(msg["ok"]){
                            layer.msg("操作成功", {time: 700}, function () {
                              //  window.location.reload();
                                row.remove().draw();
                            });

                        }
                    }
                });
                layer.close(index);
            });


        });
        $('#example').DataTable({
            'paging': true,
            'lengthChange': true,
            'searching': true,
            'ordering': true,
            'bAutoWidth': false,
            'info': true,
            'autoWidth': false
        });
    })


    $(".sidebar-menu li").click(function (e) {
        $(".sidebar-menu li").removeClass("active");
        $(this).addClass("active");
    });
</script>
</body>

</html>